package com.lanou3g.farmdoctor.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lanou3g.farmdoctor.R;
import com.lanou3g.farmdoctor.application.FDApplication;
import com.lanou3g.farmdoctor.fragment.RichItemFragment;

/**
 * 本类由: Risky 创建于: 15/11/24.
 */
public class ForRichPagerAdapter extends FragmentPagerAdapter {
    private String [] titles;
    public ForRichPagerAdapter(FragmentManager fm) {
        super(fm);
        // 初始化标题
        titles = FDApplication.getContext().getResources().getStringArray(R.array.rich_titles);
    }

    @Override
    public Fragment getItem(int position) {
        return RichItemFragment.newInstance(position);
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
